<?php

// +----------------------------------------------------------------------
// | 私信
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 微尘 <yicmf@qq.com>
// +----------------------------------------------------------------------

namespace app\event\pos;

use app\common\event\Base;
use app\model\ucenter\User as UserModel;
use think\Exception;

class UserMoney extends Base
{
    /**
     * 发送者
     * @var UserModel
     */
    protected UserModel $user;
    /**
     * 参数
     * @var array
     */
    protected array $param;

    protected $from;


    /**
     * 顾客初始化会话
     * @param array $param
     * @param UserModel $user
     */
    public function order(UserModel $user, array $param, $device = null): array
    {
        try {
            if (!$user) {
                throw new Exception('游客信息异常');
            }

//            Db::startTrans();
            $data['data']['service'] = UserModel::where('id', $chat['to_user_id'])->field('id,nickname,avatar_id,avatar_url,is_online')->find();;
            $data['data']['chat'] = $chat;
            $data['code'] = 0;
//            Db::commit();
            $data['message'] = '获取成功';
        } catch (\Exception $e) {
            // 回滚事务
//            Db::rollback();
            $data['code'] = 2;
            $data['message'] = 'file:' . $e->getFile() . ',message:' . $e->getMessage() . 'li' . $e->getLine();
//				$data['message'] = $e->getMessage();
        }
        return $data;
    }



}
